package middlewares

//func CORS() gin.HandlerFunc {
//	return func(ctx *gin.Context) {
//		ctx.Header("Access-Control-Allow-Origin", "*") // 可将将 * 替换为指定的域名
//		ctx.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
//		ctx.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization")
//		ctx.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type")
//		ctx.Header("Access-Control-Allow-Credentials", "true")
//		ctx.Writer.Header().Set("Access-Control-Max-Age", "86400")
//
//		if ctx.Request.Method == http.MethodOptions {
//			ctx.AbortWithStatus(200)
//		} else {
//			ctx.Next()
//		}
//	}
//}
